package com.sita.redsun.util;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.lang.Thread.UncaughtExceptionHandler;
/**
 * Created by zhebinwang on 2017/3/28.
 */
public class UnCatchExceptionUtil {

    private static final Logger logger = LoggerFactory
            .getLogger(UnCatchExceptionUtil.class);
    private UnCatchExceptionUtil() {

    }

    public static void declare() {
        Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
            @Override
            public void uncaughtException(Thread t, Throwable e) {
                logger.error("THREAD_TERMINATE " + t + "   " + e);
                e.printStackTrace();
            }
        });
    }

}
